Skip to content

Accept lowercase country codes in JSON Schema - #1302

Closed
daniel-myparcel wants to merge 2 commits into
developfrom
bugfix/MP-8335-lowercase-country-code-accepted-as-path-param
Closed

Accept lowercase country codes in JSON Schema#1302
daniel-myparcel wants to merge 2 commits into
developfrom
bugfix/MP-8335-lowercase-country-code-accepted-as-path-param

Conversation

@daniel-myparcel

Copy link
Copy Markdown
Contributor

What changed

  • ✨ Introduced CountryCodeUserInput for cases country codes are passed to us by a user
  • ♻️ CountryCode made into ENUM for better use of JSON Schema conventions
  • ♻️ Update path-country_code to use CountryCodeUserInput

NOTE: The reason I introduced the additional CountryCodeUserInput is because when we return a country code it will always be uppercase so changing that schema would be misleading.

Ticket

@daniel-myparcel daniel-myparcel changed the title Accepted lowercase country codes in JSON Schema Accept lowercase country codes in JSON Schema Jul 23, 2026
@daniel-myparcel
daniel-myparcel requested a review from M4tini July 23, 2026 08:35
Comment thread specification/schemas/addresses/CountryCode.json Outdated
"sx", "sy", "sz", "tc", "td", "tf", "tg", "th", "tj", "tk",
"tl", "tm", "tn", "to", "tr", "tt", "tv", "tw", "tz", "ua",
"ug", "um", "us", "uy", "uz", "va", "vc", "ve", "vg", "vi",
"vn", "vu", "wf", "ws", "xk", "ye", "yt", "za", "zm", "zw"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the heebie jeebies from this enum and am wondering why we're doing all this work in the specification.
The bug report is caused by the issue that our API forwards the path parameter without making it uppercase.
The minimal fix for this would be a strtoupper() in the API and we're done, or am I overlooking something?

It's nice to make the regex an enum, but I think we should leave that as the only change in this PR.

@daniel-myparcel daniel-myparcel Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. The ticket title says the issue is [api-specification] lowercase country code accepted which insinuates the bug is in the spec (since we also use it to validate the request body).

Now that I read the ticket again getting an empty response as the ticket mentions menas it does infact pass validation and so this is not the bug.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that even if this doesn't fix an actual bug in the flow we might want to keep this for semantic purposes.
The Spec does accepts lowercase country codes so having it reflected in the Spec is arguably logical

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@M4tini
M4tini deleted the bugfix/MP-8335-lowercase-country-code-accepted-as-path-param branch July 29, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants